<?php

/**
 * Bayer form base class.
 *
 * @method Bayer getObject() Returns the current form's model object
 *
 * @package    ndirou_affaire
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBayerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'gender'           => new sfWidgetFormInputText(),
      'firstname'        => new sfWidgetFormInputText(),
      'lastname'         => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'phone'            => new sfWidgetFormInputText(),
      'mobile'           => new sfWidgetFormInputText(),
      'street'           => new sfWidgetFormInputText(),
      'zipcode'          => new sfWidgetFormInputText(),
      'town_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Town'), 'add_empty' => false)),
      'country'          => new sfWidgetFormInputText(),
      'password'         => new sfWidgetFormTextarea(),
      'newsletter'       => new sfWidgetFormInputCheckbox(),
      'status'           => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'publish_start_at' => new sfWidgetFormDateTime(),
      'publish_end_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'gender'           => new sfValidatorString(array('max_length' => 6, 'required' => false)),
      'firstname'        => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'lastname'         => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'email'            => new sfValidatorString(array('max_length' => 96, 'required' => false)),
      'phone'            => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'mobile'           => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'street'           => new sfValidatorString(array('max_length' => 96, 'required' => false)),
      'zipcode'          => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'town_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Town'))),
      'country'          => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'password'         => new sfValidatorString(array('required' => false)),
      'newsletter'       => new sfValidatorBoolean(array('required' => false)),
      'status'           => new sfValidatorInteger(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
      'publish_start_at' => new sfValidatorDateTime(array('required' => false)),
      'publish_end_at'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bayer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Bayer';
  }

}
